The FOR /F command is the answer to innumerable questions where you want to take the output of some command, store it in a variable (%%G) then do something ...
I'm trying to assign the results of a git command to a variable in a Windows batch file. The line in question looks like: FOR /F USEBACKQ tokens=* %%i IN (` ...